var vue = new Vue({
    el: ".wrap1",
    data: {
        comment: [],
        tiezi: [],
        infoNum: {},
        replyNum: {}
    },
    methods: {
        sumbit: function () {
            var content = $('#ueditor_replace')[0].innerHTML;
            var params = getParams();
            ajaxPost("/p/saveComment", {id: params.id, content: content}, function (data) {
                window.location.reload();
            })
        },
        publish: function (id) {
            var content = $('#j_editor_for_container' + id)[0].innerHTML;
            var params = getParams();
            ajaxPost("/p/saveComments", {id: params.id,commentId:id, content: content}, function (data) {
                window.location.reload();
            })
        }
    },
    filters: {
        dateFormat: function (date) {
            return dateFormat(date, "YYYY-MM-DD HH:mm")
        }
    },
    mounted: function () {
        var _this = this;
        var p = getParams();
        // 回复贴数量
        ajaxGet("/p/replyNum",{id: p.id},function (data) {
            _this.replyNum = data.data;
        });
        // 帖子数
        ajaxGet("/f/infoNum", {}, function (data) {
            _this.infoNum = data.data;
        });
        // 帖子标题
        ajaxGet("/p/title", p, function (data) {
            _this.tiezi = data.data;
            $('#title').html("【图片】"+ data.data.title +"【缺氧伍六柒吧】_百度贴吧")
        });
        // 评论内容
        ajaxGet("/p", p, function (data) {
            _this.comment = data.data;
        });

    }
});

